Skip to content

Conversation

@arielvalentin
Copy link
Contributor

@arielvalentin arielvalentin commented Nov 6, 2025

Ensures that all HTTP client gems support unknown methods as described in semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#http-client-span

Some concessions:

  1. This change intentionally introduces structural and knowledge duplication in each client gem as a first step refactoring to extract and move the functionality into a shared helper gem or the semantic conventions gem.
  2. The HttpHelper produces a bit of primitive obsession by adding a struct that is used to copy to semconv attributes
  3. I am fixing the span names for the _OTHER method cases by setting the span names to HTTP
  4. I am preserving the invalid span name generated by the ethon gem for _OTHER to be HTTP N/A
  5. I am deferring updating span naming to the latest guidance to a future PR
  6. I am deferring supporting OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS environment variable to a future PR

See #1779

Comment on lines +66 to +69
def self.span_attrs_for(method, semconv: :stable)
normalized = METHOD_CACHE[method]
if normalized
span_name = semconv == :old ? OLD_SPAN_NAMES[normalized] : normalized
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arielvalentin - I'm concerned about changing the span names and attributes for the "old" instrumentation. It seems to break the contract for the OTEL_SEMCONV_STABILITY_OPT_IN var:

The default behavior (in the absence of one of these values) is to continue emitting whatever version of the old experimental HTTP and networking conventions the instrumentation was emitting previously.
(source)

What do you think about reverting the changes for the old modules and leaving the changes for dup and new?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok that makes sense. I can leave the span name alone in follow up PRs.

Please consider that the existing old implementation does not follow the correct conventions for span names and should not have a prefix of HTTP:

HTTP spans MUST follow the overall guidelines for span names. HTTP server span names SHOULD be {http.method} {http.route} if there is a (low-cardinality) http.route available. HTTP server span names SHOULD be {http.method} if there is no (low-cardinality) http.route available. HTTP client spans have no http.route attribute since client-side instrumentation is not generally aware of the "route", and therefore HTTP client spans SHOULD use {http.method}. Instrumentation MUST NOT default to using URI path as span name, but MAY provide hooks to allow custom logic to override the default span name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may provide hooks to allow custom logic to override the default span name is also something new to me 🤔

Ensures that all HTTP client gems support unknown methods as described in semantic conventions:

https://opentelemetry.io/docs/specs/semconv/http/http-spans/#http-client-span

See open-telemetry#1779
Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to get @hannahramadan's opinion on this too, but I'm at the point where I feel comfortable pushing this fix to the old instrumentations. It's an unimplemented feature that we likely would have fixed if we noticed/had the time. The only request I have is to mark this as a breaking change so people can be alerted their span names are changing.

@hannahramadan
Copy link
Contributor

hannahramadan commented Nov 25, 2025

Hi @arielvalentin! I was initially a little iffy on the ethon span name change, but after chatting with @kaylareopelle, I agree that if we mark this as a breaking change, then fixing the span name (HTTP N/A-> HTTP) would be a worthwhile improvement. Apologies for the back and forth - I see you already made the change back to the 'broken' state. I'm happy to fix it in a separate followup PR if we want to go ahead and merge this now.

@kaylareopelle kaylareopelle merged commit 37a0c7e into open-telemetry:main Nov 25, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants